//
//  DJHttpTool.h
//  ETC_ios
//
//  Created by xinrui on 2017/12/4.
//  Copyright © 2017年 xinrui. All rights reserved.
//

#import <Foundation/Foundation.h>

@class FCFormData;

@interface DJHttpTool : NSObject

//上传多张
+ (void)updateImageWithURL:(NSString *)url params:(NSDictionary *)params datas:(NSArray *)datas name:(NSString *)name success:(void (^)(id))success failure:(void (^)(NSError *))failure;



//post请求
+ (void)postWithURL:(NSString *)url params:(NSDictionary *)params success:(void (^)(id json))success failure:(void (^)(NSError *error))failure;


//上传单张图片
+ (void)postWithURL:(NSString *)url params:(NSDictionary *)params formData:(FCFormData *)formData success:(void (^)(id json))success failure:(void (^)(NSError *error))failure;


//get请求
+ (void)getWithURL:(NSString *)url params:(NSDictionary *)params success:(void (^)(id json))success failure:(void (^)(NSError *error))failure;


//上传图片
+ (void)updateImageWithUrl:(NSString *)url params:(NSDictionary *)params path:(NSString *)path success:(void (^)(id))success failure:(void (^)(NSError *))failure;


//封装文件下载管理类
/**
 下载文件

 @param dic {@"url":@"下载地址", @"fileName":@"文件夹名称"}
 @param progress 下载进度
 @param destination 下载成功返回路径
 @param faliure 下载失败
 */
+(void)downloadURL:(NSDictionary *)dic progress:(void (^)(NSProgress *downloadProgress))progress destination:(void (^)(NSURL *targetPath))destination failure:(void(^)(NSError *error))faliure;



//获取当前时间
+ (NSString*)nowTime:(NSString*)dateType;

@end

/**
 *  用来封装文件数据的模型
 */
@interface FCFormData : NSObject
/**
 *  文件数据
 */
@property (nonatomic, strong) NSData *data;

/**
 *  参数名
 */
@property (nonatomic, copy) NSString *name;

/**
 *  文件名
 */
@property (nonatomic, copy) NSString *filename;

/**
 *  文件类型
 */
@property (nonatomic, copy) NSString *mimeType;
@end


